package lab03.test3;

import sun.swing.SwingUtilities2;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test {
    public static void main(String[] args) {
        String path="D://txt.txt";
        FileInputStream fileInputStream=null;
        FileOutputStream fileOutputStream=null;
        try {
            fileOutputStream= new FileOutputStream(path);
            fileInputStream=new FileInputStream(path);
           fileOutputStream.write(new String("Beijing欢迎你！").getBytes());
            byte[] b=new byte[(int) path.length()];
            fileInputStream.read(b);
            System.out.println(new String(b));
            fileOutputStream.write(new String("我的学号是：你自己的学号").getBytes());

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                fileInputStream.close();
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
